import React, { memo,useState } from 'react';

const useMyHook = (value,number)=>{
    let [count,setCount] = useState(value);

    const add =()=> {
        setCount(count+number)
    }

    return { count,add }
}


const index = memo(() => {
    let {count,add} = useMyHook(10,2) //初始值为10 每次+2
    return (
        <div>
            <h4 onClick={e=>{
                add()
            }} >
                {count} A
            </h4>
        </div>
    );
});

export default index;